1. generic device 1

在本系列视频中,我们将开始研究另一种模块化方法,因为我们认为模块化是 p.l.c. 非常重要的一部分。
In this series of videos, we will start looking at another approach for modularity as we sell modularity is a very important part of p.l.c.

编程。
programming.

在本系列视频中,我们将学习如何将其提升到一个新的水平。
And in this series of video, we will learn how to take it to the next level.

因此,我们在这里要做的是创建一个功能块,一个单一的功能块,应该能够仅根据其配置来处理许多不同类型的设备。
So what we want to do here is to create a function block, a one single function block that should be able to handle many different kind of devices according only to its configuration.

因此,我们必须创建一个可以在许多不同类型的环境和许多不同类型的设备中使用的块。
So we would have to create a block that you can use in many different kinds of environment and for many different kinds of devices.

因此,如果您打开该项目的附件,您会发现另一个示例,呃,项目,您会在其中看到一个空的主程序,这是一个模拟,您不应该写入其中。
So if you open the attach to the project, you will find another sample, uh, project where you see an empty main program, a simulation that, again, you should not write into.

在这里,您将看到一个可视化效果,您可以在其中找到许多不同类型的设备。
And over here you will have a visualization where you can find many different kind of devices.

这些都是不同类型的活塞。
These are all different kinds of piston's.

他们可能会觉得你看起来很相似,但实际上他们有很大不同。
They may see it look the same to you, but they are actually very different.

所以现在,呃,我们的目标是创建一个能够处理所有这些不同类型的活塞的功能块。
So now, uh, our our goal is to create a function block that would be able to to handle all these different kinds of piston's.

所以在这个,呃,在这个可视化中,你可以看到有不同类型的首字母缩略词。
So in this, uh, in this visualization, you can see there are different kind of acronyms.

你在活塞队看到或听到的第一个缩写词是我使用的驱动缩写词。
And the first acronym that you see or hear on the Pistons is the actuation acronym that I use.

这意味着如果活塞是单次激活或双次激活,则单次激活意味着只有一个主体和变量与其交互。
The meaning the if the piston is a single activation or a double activation, a single activation, that means you have only one body and variable to interact with it.

所以如果我上网,你就可以在这里非常非常简单地看到这一点。
So if I go online, you can see this very, very simply right here.

我们没有编写任何代码。
We don't have any code written.

我们只有这个简单的按钮来强制,呃,变量的值。
We just have this simple buttons to force the, uh, the values of the variables.

因此,如果我从这里开始,这是一个非常简单的活塞,只需一次激活。
So if I start over here, this is a very simple piston with a single activation.

一次激活意味着如果 this Bolian 等于 true,活塞将开始向前移动。
A single activation means that if the this Bolian gets equal to true, the piston will start moving forward.

如果它变得相等,也等于活塞将开始向后移动而不是双重激活。
If it becomes equal, equal to also the piston will start moving backward instead of the double activation.

例如,让我们看一下这个。
Let's look, for instance, at this one.

双重激活以不同的方式工作。
The double activation works in a different way.

如果您有两个布尔变量与活塞交互,并且启用第一个变量,它将向前移动。
If you have two boolean variables to interact with the piston and if you enable the first one, it will move forward.

如果启用第二个,它将向后移动。
If you enable the second one, it will move backwards.

如果您禁用它们,活塞将保持不变。
And if you disable both of them, the piston will stay.

所以,举例来说,如果我这样做,你可以看到我停止了活塞,如果我这样做,我开始向后移动它。
So, for instance, if I do this, you can see I stopped the piston and if I did this, I started moving it backward.

第一个和最后一个之间的主要区别在于该活塞不能停止在中间位置。
The main difference between this, the first one and the last one, is that this piston cannot stop in an intermediate position.

也只会止于此。
It will only stop at this.

它是负极限或正极限。
It's a negative limit or at its positive limits.

相反,另一个能够停止在不同的中间位置。
Instead, the other one is able to stop in different intermediate positions.

这就是激活的两种主要配置,单次激活或双倍激活,涉及反馈,即放置在设备内的传感器。
So this is what what are these are the two main configurations for activation, single activation or double the tuition for what concerns the feedback's, meaning the sensors that are placed within the device.

我们有四种不同的可能性。
We have four different possibilities.

正如您在这里看到的,我们有第一个,这不是反馈。
We have the first one, as you can see over here, that is not feedback.

正如您所看到的,我们这里没有任何传感器可以告诉我们活塞的实际位置。
So as you can see, we don't have any sensors over here that tells us where the piston actually is.

这是最简单的一种设备,实际上我们对设备所在位置、状态的信息知之甚少。
This is the simplest kind of device and it is actually the one on which we have little information about where the device in what state the device is.

第二个就在第二个里。
The second one is in the second one.

您有一个已启用的反馈。
You have a single enabled feedback.

因此,在这里我们只有活塞启用时的反馈。
So over here we have only feedback when the the piston is enabled.

这是这里的这个。
And this is this this one over here.

因此,如果我将活塞移动到正极限,您可以看到这个绿色小方块变成绿色。
So if I move the piston to the positive limit, you can see this little green square turning green.

如果我移动它。
And if I move it.

后退。
Back.

它会变成它会变成假的,它会以类似的方式变成红色。
It will become it will become false, it will become red in an analogous way.

您有一个禁用反馈,因此您有一个传感器放置在负限制上。
You have this single disable feedback, so you have a sensor placed on the negative limit.

因此,您可以在设备被禁用时获得反馈,或者最完整的是双重反馈。
So you have a feedback of when the device is disabled or the most complete of all is the double feedback.

就像这个、第四个或第七个一样,你可以看到我们这里有一个传感器,那里也有一个传感器。
So like this one, the fourth or the seventh, you can see that we have a sensor over here and the sensor over there.

因此,我们可以获得有关活塞是否处于负极限、正极限或介于两者之间的信息。
So we have an information on if the piston is on its negative limit or on its positively in it or in between.

因此,我们的目标是创建一个可用于控制所有这些活塞的函数,然后我们将该函数块移至我们的主项目中。
So our goal is to create a function that can be used to control all of these pistons and then we will move this function block up to our main project.

那么这个功能块应该做什么呢?
So what should this function block do?

您应该能够在这里看到您有一个按钮,该按钮是一个启用的活塞按钮,但现在根本没有执行任何操作。
You should be able to you can see over here you have a button that is an enabled piston button that right now is not doing anything at all.

仅使用此按钮,您应该能够正确控制活塞将其移动到其最终位置或将其移回其原始位置直至该负极限。
And with only this button, you should be able to control correctly the piston moving it to its end position or moving it back to its original position to this negative limit.

所以,呃,这种方法对于检测传感器和执行器上的故障也很有用。
So this, uh, this approach is also useful to detect the faults on both sensors and actuators.

因此,在实现了我们想要的活塞标准标称控制后,您将看到通过一些简单的调整,我们可以对每个设备组件进行全面诊断。
So after having it, having implemented the standard nominal control that we want for the Pistons, you will see that with some simple tweaks so we can have a full diagnosis on each device component.

因此,我们将能够判断这些传感器之一是否出现故障,或者激活是否不再起作用。
So we will be able to tell if, for instance, one of these sensors has become faulty or if the activation is no longer working.

所有这些信息都将直接来自该功能块。
And all this information will come directly from that function block.

正如您在每次致动、Bolian 和每个传感器上看到的那样,我实际上放置了两个按钮,一个用于强制其通过,一个用于强制其强制。
As you can see on each actuation, Bolian and on each sensor, I placed actually two buttons, one to force it to through and one to force it to force.

通过这种方式,我们将能够模拟这些设备上的故障,以实际尝试看看我们的通用设备是否能够检测传感器和执行器上的故障。
In this way, we will be able to simulate faults on this, uh, on the on these devices to actually try and see if our generic device will be able to to detect the faults on the sensors and actuators.

这样,您就可以在设备上免费获得详细、详细的诊断。
In this way, you will be able to get that for free at the detail, detailed diagnosis on the device.

那么在此之后,我们将尝试为我们编写这个通用设备功能块是什么?
So after this, we will try and write what is this generic device function block for us?